package org.jbase.jbsc.commons.core.domain;

import io.swagger.annotations.ApiModelProperty;

public class IdEntity extends Entity{

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ApiModelProperty("ID值的字符串形式")
    public String getIdStr() {
        if (null == id)
            return "";
        return "" + id;
    }

    @ApiModelProperty("ID，唯一编号")
    private Long id;

    @Override
    public String toString() {
        return "ClassName:" + getClass().getName() + ";id:" + getId();
    }

    @Override
    public int hashCode() {
        int id2 = Long.hashCode(getId());
        return super.hashCode() + id2;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!(obj instanceof IdEntity))
            return false;
        IdEntity entity = (IdEntity) obj;

        return this.getId() == entity.getId();
    }
}
